package io.rong.app.ui;

import android.content.Context;
import android.text.TextUtils;

import com.yunshipei.ui.dialog.WaitDialog;


/**
 * Created by bob on 2015/1/28.
 */
public class LoadingDialog {

    private WaitDialog waitDialog;

    public LoadingDialog(Context context) {
        waitDialog = new WaitDialog(context);
    }

    public void show() {
        if (waitDialog.isShowing()) return;
        waitDialog.show();
    }

    public void dismiss() {
        if (!waitDialog.isShowing()) return;
        waitDialog.dismiss();
    }

    public void setText(String s) {
        if (TextUtils.isEmpty(s)) {
            waitDialog.setMessage("请稍后...");
            return;
        }
        waitDialog.setMessage(s);
    }

    public boolean isShowing() {
        return waitDialog.isShowing();
    }

    public void setCancelable(boolean cancelable) {
        waitDialog.setCancelable(cancelable);
    }
}
